package com.yupi.moshu.common;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    //配置图片的访问路径
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //访问路径： http://localhost:8080/img/xxx.jpg
        registry.addResourceHandler("/img/**").addResourceLocations("file:/home/Pluviophile/web_project/backend/classes/public/img/");
        registry.addResourceHandler("/attachment/**").addResourceLocations("file:/home/Pluviophile/web_project/backend/classes/public/attachment/");
        //访问路径对应的本地路径
    }
}
